package main

import "fmt"

/*
   @Time : 2018/9/29 11:11 
   @Author : ff
*/

func main() {
	case_2()
}

func case_1()  {
	a := 1
	switch a {
	case 0:
		fmt.Println("a = 0")
	case 1:
		fmt.Println("a = 1")
	}

}

/**
   如希望继续执行下一个case，需使用fallthrough语句
 */
func case_2()  {
	a := 1
	switch {
	case a >= 0:
		fmt.Println("a >= 0")
		fallthrough
	case a >= 1:
		fmt.Println("fallthrough 执行了")
		fmt.Println("a >= 1")
	}

}

func case_3()  {

	switch a := 1;{
	case a >= 0:
		fmt.Println("a >= 0")
		fallthrough
	case a >= 1:
		fmt.Println("fallthrough 执行了")
		fmt.Println("a >= 1")
	}

}